/**
 * 单例设计模式懒汉式
 */
public class SingleTonLazy {
    //定义一个实例化对象
    private static SingleTonLazy singleTonLazy = null;

    //构造方法私有化
    private SingleTonLazy(){}
    //静态工厂方法
    private static SingleTonLazy getInstance(){
        if (singleTonLazy == null){
            singleTonLazy = new SingleTonLazy();
        }
        return singleTonLazy;
    }

    public static void main(String[] args) {
        SingleTonLazy singleTonLazy = SingleTonLazy.singleTonLazy;
        SingleTonLazy singleTonLazy1 = SingleTonLazy.singleTonLazy;
        System.out.println(singleTonLazy == singleTonLazy1);
    }
}


